Skip to content

feat: restore scroll behavior from working commit#353

Merged
sudo-tee merged 6 commits intosudo-tee:mainfrom
jugarpeupv:main
Apr 12, 2026
Merged

feat: restore scroll behavior from working commit#353
sudo-tee merged 6 commits intosudo-tee:mainfrom
jugarpeupv:main

Conversation

@jugarpeupv
Copy link
Copy Markdown
Contributor

@jugarpeupv jugarpeupv commented Apr 9, 2026

refactor(ui): simplify output window scroll tracking

Restore ed0c07815e867f3b71f4e012de4781cc24fb29e5 scroll behavior

Replace the sticky `_was_at_bottom_by_win` flag with a new approach that
tracks the previous line count per window. The `is_at_bottom` logic now
compares the cursor position to the previous and current line counts,
making auto-scroll behavior more robust and less dependent on viewport
events. This also removes redundant comments and unused code, and
ensures scroll tracking state is reset consistently.

@sudo-tee in your main branch the scroll behavior is not working, i mean, no matter how you define the always scroll to bottom setting, that the buffer is always scrolled to bottom

This pr is to restore working scroll behavior from previous commit

Allow users to customize window-local options for the input window via
`ui.input.win_options` in config. Any valid Neovim window option can be set,
such as signcolumn, cursorline, number, relativenumber, etc. This improves
flexibility for user preferences and editor appearance.
Restore ed0c078 scroll behavior

Replace the sticky `_was_at_bottom_by_win` flag with a new approach that
tracks the previous line count per window. The `is_at_bottom` logic now
compares the cursor position to the previous and current line counts,
making auto-scroll behavior more robust and less dependent on viewport
events. This also removes redundant comments and unused code, and
ensures scroll tracking state is reset consistently.
Update tests to reflect the new cursor-based scroll tracking logic in
output_window. Remove references to the old viewport-based flag and
simulate user actions by moving the cursor instead. This ensures tests
align with the simplified auto-scroll behavior.
end

-- Prefer the sticky flag when it has been set by scroll/WinScrolled events.
-- Fall back to a live viewport check on the very first call (flag is nil).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick question: does viewport position still drive is_at_bottom() tracking in this change, or is it now cursor-only?

I often pull the viewport away from the bottom using the touchpad, so I want to confirm whether this part will cause a change in behavior.

@jensenojs
Copy link
Copy Markdown
Contributor

Additionally, I cannot reproduce this issue locally (851e865), There could be some subtler bug here

@jugarpeupv
Copy link
Copy Markdown
Contributor Author

jugarpeupv commented Apr 10, 2026

@jensenojs i dont know, the breaking code was introduced in this commit

commit 2f73a21
Author: Francis Belanger [email protected]
Date: Tue Apr 7 09:13:55 2026 -0400

refactor(renderer): decouple events from buffer manipulation  (#340)

in this PR i am just trying to restore the code as it was before this commit

Anyway i think you could checkout my branch and test your usecases

I tested it and now it has the best behavior, which is to behave like a terminal buffer, when the cursorline is at the end of the buffer, and new content is appended, then the cursorline scrolls with the new content, and when the cursorline is not at the end of the buffer, that means the users is reading something, so the cursorline is not scrolled down as new content is rendered

@sudo-tee
Copy link
Copy Markdown
Owner

I see what is your intent there. But I changed the scroll behavior in my last refactor because it would often stop scrolling even if the cursor didn't move in the output. Most of the time It would stop scrolling before the last message.

So basically what it not working for you ?

Scroll just don't work ?
Always scroll to bottom config is not working ?

@jugarpeupv
Copy link
Copy Markdown
Contributor Author

jugarpeupv commented Apr 10, 2026

@sudo-tee with the refactor code, every time new content is added to the output window, the cursor is placed at the end of the new content, making a scroll effect, and also, if i press "k" several times to move up the cursor when new content is rendered, then cursor keeps going down as new content comes

i think the best behavior is like i said, to make it work like in neovim terminal buffers:

--> cursor is at end of line --> keep moving cursorline to the new appended content
--> cursor is not at the end of line --> means user is reading something --> do not move cursor to the new end of the buffer as new content arrive

@sudo-tee
Copy link
Copy Markdown
Owner

@jugarpeupv

I don't have this issue myself on main, it behave exactly how you describe it.

But I will still merge it if it helps

@sudo-tee sudo-tee merged commit 0ce125b into sudo-tee:main Apr 12, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants